import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { controlequipmentVO, controlequipmentForm, controlequipmentQuery, equipmentQuery, equipmentVO } from '@/api/security/firefighting/fire-equipment/types';

/**
 * 查询消防设备列表
 * @param query
 * @returns {*}
 */

export const listcontrolequipment = (query?: controlequipmentQuery): AxiosPromise<controlequipmentVO[]> => {
  return request({
    url: '/fire/controlEquipment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询消防设备详细
 * @param fireControlEquipmentId
 */
export const getcontrolequipment = (fireControlEquipmentId: string | number): AxiosPromise<controlequipmentVO> => {
  return request({
    url: '/fire/controlEquipment/' + fireControlEquipmentId,
    method: 'get'
  });
};

/**
 * 新增消防设备
 * @param data
 */
export const addcontrolequipments = (data: controlequipmentForm) => {
  return request({
    url: '/fire/controlEquipment',
    method: 'post',
    data: data
  });
};

/**
 * 新增消防设备
 * @param data
 */
export const addcontrolequipment = (data: controlequipmentForm) => {
  return request({
    url: '/equipment/equipment-info/save-fire-equipment',
    method: 'post',
    data: data
  });
};



/**
 * 修改消防设备
 * @param data
 */
export const updatecontrolequipment = (data: controlequipmentForm) => {
  return request({
    url: '/fire/controlEquipment',
    method: 'put',
    data: data
  });
};

/**
 * 删除消防设备
 * @param fireControlEquipmentId
 */
export const delcontrolequipment = (fireControlEquipmentId: string | number | Array<string | number>) => {
  return request({
    url: '/fire/controlEquipment/' + fireControlEquipmentId,
    method: 'delete'
  });
};

/**
 * 查询未绑定消防设备列表
 * @param fireControlEquipmentId
 */
export const listnobindquipment =  (query?: equipmentQuery): AxiosPromise<equipmentVO[]> => {
  return request({
    url: '/fire/controlEquipment/listNoBindFire',
    method: 'get',
    params: query
  });
};
